<template>
    <view v-if="firstLoad">
        <pageIndex ref="pageIndex" v-if="isLogin" />
        <pageLoginPsd v-else />
    </view>
</template>

<script>
import pageIndex from "@/pages/index/index"
import pageLoginPsd from "@/pages/login/login_psd"
export default {
    components: {
        pageIndex, pageLoginPsd
    },
    data() {
        return {
            firstLoad: false,
            isLogin: false
        };
    },
    computed: {},
    onLoad() {
        this.getIsLogin();
        this.firstLoad = true
        uni.$on("APP_LOGIN_CHANGE", () => {
            this.getIsLogin();
        })
    },
    methods: {
        getIsLogin() {
            this.isLogin = this.$comFun.getUserToken() ? true : false
            // #ifdef APP-PLUS
            if (process.env.NODE_ENV == 'production' && this.isLogin) {
                getApp().initAppUpdate()
            }
            // #endif
        }
    },
};
</script>

<style lang="scss" scoped></style>
